$(function() {

	/* Custom SrollBar in Categories List */
	if($(".scroll-panel").length) {
		$('.scroll-panel').jScrollPane({
			verticalDragMinHeight : 59,
			verticalDragMaxHeight : 59
		});
	}
	
	
	// If Home Page Has Categories
	if($("div#home-categories").length) {

		$("div#home-categories").anythingSlider({		
			hashTags : false,
			buildNavigation : false,
			buildArrows : false,
			autoPlay : false,
			buildStartStop : false,
			infiniteSlides : false,
			stopAtEnd:true
		});

		$("div#home-slider-arrows a#prev-btn").click(function() {
			$('div#home-categories').data('AnythingSlider').goBack();
			return false;
		});

		$("div#home-slider-arrows a#next-btn").click(function() {
			$('div#home-categories').data('AnythingSlider').goForward();	
			return false;
		});
	}
	
	// Choose Categories Button
	$("a#choose-categories-btn").click(function() {
		$("div#choose-category-list").slideToggle();
		return false;
	});
		
	if( $.browser.msie && parseInt($.browser.version, 10) == 7  )
	{
		$("#choose-category-list a").css('width', $("#choose-category-list").width());
	}
	
	
	
	// Product Content Tabs
	$("#content-tabs ul li a").click(function() {
		
		$(this).parent().addClass('active'); // add active class on clicked tab
		$(this).parent().siblings().removeClass('active'); // remove active class from other tabs
		$(".product-content").hide(); // hide all tab contents
		$($(this).attr('href')).show(); // show clicked tab content
		
		return false;
	});

	// Comments Button 
	$("a#comments-btn").click(function() {
		
		var btn = $(this);		
		if( btn.hasClass('opened') )
		{
			btn.removeClass('opened').addClass('closed');
			$("#comments").slideUp();
		} 
		else if( btn.hasClass('closed') )
		{
			btn.removeClass('closed').addClass('opened');
			$("#comments").slideDown();
		}
	
		return false;
	});				
		

});
